package cn.kgc.springcloud.client;

import cn.kgc.springcloud.entity.Order;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/2/17
 * @Description:
 */
@FeignClient("ORDERSERVICE")  // 负载均衡  轮循
public interface OrderClient {

    @RequestMapping("/order/test1")
    String test01();   //   http://loalhost:8506/order/test1

    @RequestMapping("/order/test2")  //  声明参数的组织方式
    String test02(@RequestParam("id")Integer id);   //   http://loalhost:8506/order/test2?id=1


    @RequestMapping("/order/test3/{id}")   //  restful风格
    public String test03(@PathVariable("id") Integer id);   // http://ORDERSERVICE/order/test3/12

    @RequestMapping("/order/test4")
    String test04(@RequestBody Order order);  // json


    @RequestMapping("/order/test5")
    Order test05(@RequestParam("id") Integer id);

}
